package blackjack;

import java.util.LinkedList;

public class Hand {

	public LinkedList<Card> cards = new LinkedList<Card>();


	// Contructor - deal two cards
	public Hand() {
		cards.add(new Card());
		cards.add(new Card());
	}

	public boolean hasAce() {
		boolean ace = false;
		for (Card c : cards) {
			if (c.cardName.equals("Ace")) {ace = true;}
		}
		return ace;
	}

	public int numAce() {
		int i = 0;
		for (Card c : cards) {
			if (c.cardName.equals("Ace")) {i++;}
		}
		return i;
	}

	public Card firstCard() {
		return cards.getFirst();
	}

	public Card lastCard() {
		return cards.getLast();
	}

	public void addCard() {
		cards.add(new Card());
	}

	public int count() {
		int count = 0;
		for (Card c : cards) {count = count + c.cardVal;};
		return count;
	}

	public int hiddenCount() {
		int count = 0;
		count = cards.getFirst().cardVal;
		return count;
	}

	public String cardList() {

		String hand = "Cards Showing:";
		for (Card c : cards) hand = hand + "\n" + c.fullName;
		return hand;

	}

	public String hiddenCardList() {

		String hand = "Cards Showing:";
		hand = hand + "\n" + cards.getFirst().fullName;
		return hand;

	}

	public boolean isBust() {
		if (count() > 21) {
			return true;} else
			{return false;
			}	
	}

}
